package test07;
import java.util.Arrays;
import java.util.function.Supplier;

/**
 * @Author czl
 * @Date 2024-04-10
 */
public class MainTest {

    public static void print(Supplier supplier){
        Student student = (Student) supplier.get();
        System.out.println(student.getName() + "-" + student.getAge());
    }


    public static void main(String[] args) {
        Student[] student = {
                new Student("张三",17),
                new Student("李四",60),
                new Student("王五",29),
        };
        Arrays.sort(student, (o1, o2) -> o1.getAge() - o2.getAge());

        print(() -> student[0]);
    }
}
